{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Widgets Overview"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The following is a run through of the widgets you can create with Interact. All widgets allow for the following keyword arguments:\n",
    "\n",
    "* `label`: Label to be shown next to the widget\n",
    "* `value`: The value the widget should be set to when created\n",
    "* `signal`: A signal object of type `Reactive.Input` which gets the value of the widget as user enters input.\n",
    "\n",
    "Many of the widgets have keyword arguments specific to them. See below for more."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div id=\"interact-js-shim\">\n",
       "    <script charset=\"utf-8\">\n",
       "(function (IPython, $, _, MathJax) {\n",
       "    $.event.special.destroyed = {\n",
       "\tremove: function(o) {\n",
       "\t    if (o.handler) {\n",
       "\t\to.handler.apply(this, arguments)\n",
       "\t    }\n",
       "\t}\n",
       "    }\n",
       "\n",
       "    var OutputArea = IPython.version >= \"4.0.0\" ? require(\"notebook/js/outputarea\").OutputArea : IPython.OutputArea;\n",
       "\n",
       "    var redrawValue = function (container, type, val) {\n",
       "\tvar selector = $(\"<div/>\");\n",
       "\tvar oa = new OutputArea(_.extend(selector, {\n",
       "\t    selector: selector,\n",
       "\t    prompt_area: true,\n",
       "\t    events: IPython.events,\n",
       "\t    keyboard_manager: IPython.keyboard_manager\n",
       "\t})); // Hack to work with IPython 2.1.0\n",
       "\n",
       "\tswitch (type) {\n",
       "\tcase \"image/png\":\n",
       "            var _src = 'data:' + type + ';base64,' + val;\n",
       "\t    $(container).find(\"img\").attr('src', _src);\n",
       "\t    break;\n",
       "\tdefault:\n",
       "\t    var toinsert = OutputArea.append_map[type].apply(\n",
       "\t\toa, [val, {}, selector]\n",
       "\t    );\n",
       "\t    $(container).empty().append(toinsert.contents());\n",
       "\t    selector.remove();\n",
       "\t}\n",
       "\tif (type === \"text/latex\" && MathJax) {\n",
       "\t    MathJax.Hub.Queue([\"Typeset\", MathJax.Hub, toinsert.get(0)]);\n",
       "\t}\n",
       "    }\n",
       "\n",
       "\n",
       "    $(document).ready(function() {\n",
       "\tfunction initComm(evt, data) {\n",
       "\t    var comm_manager = data.kernel.comm_manager;\n",
       "        //_.extend(comm_manager.targets, require(\"widgets/js/widget\"))\n",
       "\t    comm_manager.register_target(\"Signal\", function (comm) {\n",
       "            comm.on_msg(function (msg) {\n",
       "                var val = msg.content.data.value;\n",
       "                $(\".signal-\" + comm.comm_id).each(function() {\n",
       "                var type = $(this).data(\"type\");\n",
       "                if (typeof(val[type]) !== \"undefined\" && val[type] !== null) {\n",
       "                    redrawValue(this, type, val[type], type);\n",
       "                }\n",
       "                });\n",
       "                delete val;\n",
       "                delete msg.content.data.value;\n",
       "            });\n",
       "\t    });\n",
       "\n",
       "\t    // coordingate with Comm and redraw Signals\n",
       "\t    // XXX: Test using Reactive here to improve performance\n",
       "\t    $([IPython.events]).on(\n",
       "\t\t'output_appended.OutputArea', function (event, type, value, md, toinsert) {\n",
       "\t\t    if (md && md.reactive) {\n",
       "                // console.log(md.comm_id);\n",
       "                toinsert.addClass(\"signal-\" + md.comm_id);\n",
       "                toinsert.data(\"type\", type);\n",
       "                // Signal back indicating the mimetype required\n",
       "                var comm_manager = IPython.notebook.kernel.comm_manager;\n",
       "                var comm = comm_manager.comms[md.comm_id];\n",
       "                comm.then(function (c) {\n",
       "                    c.send({action: \"subscribe_mime\",\n",
       "                       mime: type});\n",
       "                    toinsert.bind(\"destroyed\", function() {\n",
       "                        c.send({action: \"unsubscribe_mime\",\n",
       "                               mime: type});\n",
       "                    });\n",
       "                })\n",
       "\t\t    }\n",
       "\t    });\n",
       "\t}\n",
       "\n",
       "\ttry {\n",
       "\t    // try to initialize right away. otherwise, wait on the status_started event.\n",
       "\t    initComm(undefined, IPython.notebook);\n",
       "\t} catch (e) {\n",
       "\t    $([IPython.events]).on('kernel_created.Kernel kernel_created.Session', initComm);\n",
       "\t}\n",
       "    });\n",
       "})(IPython, jQuery, _, MathJax);\n",
       "</script>\n",
       "    <script>\n",
       "        window.interactLoadedFlag = true\n",
       "       $(\"#interact-js-shim\").bind(\"destroyed\", function () {\n",
       "           if (window.interactLoadedFlag) {\n",
       "               console.warn(\"JavaScript required by Interact will be removed if you remove this cell or run using Interact more than once.\")\n",
       "           }\n",
       "       })\n",
       "       $([IPython.events]).on(\"kernel_starting.Kernel kernel_restarting.Kernel\", function () { window.interactLoadedFlag = false })\n",
       "   </script>\n",
       "</div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "using Interact\n",
    "using Reactive"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Slider"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Sliders are arguably the most useful of the widgets. A slider can be created with the `slider{T <: Number}(range::Range{T})` function. The value of the slider defaults to the median of the range, and can be set using the `value::T` keyword argument. The type of signal a slider depends on the type of the range. E.g. A floating point range like `0:π/4:2π` gives a signal of floating point values, while a range like `1:10` gives a signal of integers."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Slider{Float64}(Signal{Float64}(3.141592653589793, nactions=1),\"\",3.141592653589793,0.0:0.7853981633974483:6.283185307179586,\"horizontal\",true,\".3f\",true)"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "float_slider = slider(0:π/4:2π)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Slider{Int64}(Signal{Int64}(5, nactions=1),\"\",5,1:10,\"horizontal\",true,\"d\",true)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "int_slider = slider(1:10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 4,
     "metadata": {
      "comm_id": "8d6a9345-3c09-4649-9de0-c18374321d2d",
      "reactive": true
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "signal(int_slider)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Checkbox"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`checkbox` takes an optional first argument which defaults to `false` and creates a checkbox."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Checkbox(Signal{Bool}(false, nactions=0),\"\",false)"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Checkbox(Signal{Bool}(true, nactions=0),\"\",true)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "display(checkbox())\n",
    "checkbox(true)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Toggle"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can create a toggle button with `togglebutton` which takes as an optional argument its label."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.ToggleButton(Signal{Bool}(true, nactions=0),\"Mary called\",true)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "status = togglebutton(\"Mary called\", value=true)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"Mary called\""
      ]
     },
     "execution_count": 7,
     "metadata": {
      "comm_id": "d1017af2-c163-40b6-9d23-c0d7bdae769b",
      "reactive": true
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "map(s -> s ? \"Mary called\" : \"Mary didn't call\", signal(status))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Button"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A button gives out a signal of a constant signal which is `nothing` by default. You can set this using the `value` keyword argument. The signal updates when the button is clicked. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Button{Void}(Signal{Void}(nothing, nactions=0),\"Click Me\",nothing)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b = button(\"Click Me\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here is how you can count the number of clicks made on a button using `foldp` on the signal, (think of `foldp` as fold over past values):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 9,
     "metadata": {
      "comm_id": "67f4bf90-1bbf-4182-bd11-eba452128130",
      "reactive": true
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "foldp((acc, value) -> acc + 1, 0, signal(b))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Option widgets"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "There are 3 options widgets: `dropdown`, `togglebuttons`, `radiobuttons`. There are two types allowed as an argument while invoking these:\n",
    "1. `AbstractArray` (e.g. `Vector`, `Tuple`)\n",
    "2. `Associative` (e.g. `Dict`, `OrderedDict`)\n",
    "The default value is the first element (or undefined in case of an undordered `Associative` like `Dict`), but this can be set using the `value` keyword argument."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Options{:Dropdown,String}(Signal{String}(one, nactions=1),\"\",\"one\",\"one\",Interact.OptionDict(DataStructures.OrderedDict(\"one\"=>\"one\",\"two\"=>\"two\",\"three\"=>\"three\"),Dict(\"two\"=>\"two\",\"one\"=>\"one\",\"three\"=>\"three\")),Any[],Any[],true,\"horizontal\")"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = dropdown([\"one\", \"two\", \"three\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"one\""
      ]
     },
     "execution_count": 11,
     "metadata": {
      "comm_id": "1fe857ae-7934-497b-be04-0428136febcc",
      "reactive": true
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "signal(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Options{:RadioButtons,Function}(Signal{Function}(-, nactions=1),\"\",-,\"Sub\",Interact.OptionDict(DataStructures.OrderedDict{String,Function}(\"Sub\"=>-,\"Add\"=>+,\"Exp\"=>^),Dict{Function,String}(Pair{Function,String}(^,\"Exp\"),Pair{Function,String}(-,\"Sub\"),Pair{Function,String}(+,\"Add\"))),Any[],Any[],true,\"horizontal\")"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f = radiobuttons(Dict(\"Add\" => +, \"Sub\" => -, \"Exp\" => ^))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2.718281828459045 - 3.141592653589793im"
      ]
     },
     "execution_count": 13,
     "metadata": {
      "comm_id": "c5a72ba9-c8b4-40b8-9a2f-26a18ad4b731",
      "reactive": true
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "map(g -> g(e, π*im), signal(f))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Notice that the order \"Add\", \"Sub\", \"Exp\" was not retained in the above example, because a `Dict` does not save the ordering. To overcome this, we can use `OrderedDict` from DataStructures.jl package."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Options{:ToggleButtons,Function}(Signal{Function}(+, nactions=1),\"\",+,\"Add\",Interact.OptionDict(DataStructures.OrderedDict{String,Function}(\"Add\"=>+,\"Sub\"=>-,\"Exp\"=>^),Dict{Function,String}(Pair{Function,String}(^,\"Exp\"),Pair{Function,String}(-,\"Sub\"),Pair{Function,String}(+,\"Add\"))),Any[],Any[],true,\"horizontal\")"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f_ = togglebuttons([(\"Add\", +), (\"Sub\", -), (\"Exp\", ^)])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2.718281828459045 + 3.141592653589793im"
      ]
     },
     "execution_count": 15,
     "metadata": {
      "comm_id": "b1fc528f-2091-455c-acde-edcfa1cd536a",
      "reactive": true
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "map(g -> g(e, π*im), signal(f_))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Textbox"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A textbox can be of a `Number` or `AbstractString` type. `textbox` takes one argument: its default value."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Textbox{String}(Signal{String}(Change me, nactions=1),\"\",nothing,\"Change me\")"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "string_box = textbox(\"Change me\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"Change me\""
      ]
     },
     "execution_count": 17,
     "metadata": {
      "comm_id": "22c28cc6-60ad-466c-a32c-7f0fbfe55f3d",
      "reactive": true
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "signal(string_box)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A textbox can be of a `Number` type as well. Just set a default number value, or use `textbox(typ=T)` where T is a `Number` type."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Textbox{Int64}(Signal{Int64}(0, nactions=1),\"\",nothing,0)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "int_box = textbox(0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 19,
     "metadata": {
      "comm_id": "f3d142a3-9011-4070-a64f-cc508ab368b5",
      "reactive": true
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "signal(int_box)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If creating a number typed textbox, you can also pass along an optional `range` field to set a bound on the possible values one can input. If an entered value exceeds the range, it is replaced by its nearest bounding number."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Textbox{Float64}(Signal{Float64}(6.283185307179586, nactions=1),\"\",-10.0:1.0:10.0,6.283185307179586)"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bounded_float_box = textbox(2pi, range=-10.0:10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "6.283185307179586"
      ]
     },
     "execution_count": 21,
     "metadata": {
      "comm_id": "8b118a79-5db9-4853-8332-e0a85c87ec4f",
      "reactive": true
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "signal(bounded_float_box)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Textarea"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`textarea` takes an optional default value and creates a textarea. Its signal changes when you type."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Textarea{String}(Signal{String}(Your very own $\\LaTeX$ editor, nactions=0),\"\",\"Your very own \\$\\\\LaTeX\\$ editor\")"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tex = textarea(\"Your very own \\$\\\\LaTeX\\$ editor\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Latex(\"\",\"Your very own \\$\\\\LaTeX\\$ editor\")"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "map(latex, signal(tex))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## The `widget` Function"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`widget` tries to coerce a value into a widget."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Options{:SelectionSlider,Int64}(Signal{Int64}(6, nactions=1),\"\",6,\"6\",Interact.OptionDict(DataStructures.OrderedDict(\"1\"=>1,\"2\"=>2,\"3\"=>3,\"4\"=>4,\"5\"=>5,\"6\"=>6,\"7\"=>7,\"8\"=>8,\"9\"=>9,\"10\"=>10…),Dict(7=>\"7\",4=>\"4\",9=>\"9\",10=>\"10\",2=>\"2\",3=>\"3\",5=>\"5\",8=>\"8\",6=>\"6\",1=>\"1\"…)),Any[],Any[],true,\"horizontal\")"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Checkbox(Signal{Bool}(false, nactions=0),\"\",false)"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Textbox{AbstractString}(Signal{AbstractString}(text, nactions=1),\"\",nothing,\"text\")"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Textbox{Float64}(Signal{Float64}(1.1, nactions=1),\"\",nothing,1.1)"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Options{:ToggleButtons,Symbol}(Signal{Symbol}(on, nactions=1),\"\",:on,\"on\",Interact.OptionDict(DataStructures.OrderedDict(\"on\"=>:on,\"off\"=>:off),Dict(:off=>\"off\",:on=>\"on\")),Any[],Any[],true,\"horizontal\")"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "Interact.Options{:ToggleButtons,Float64}(Signal{Float64}(6.283185307179586, nactions=1),\"\",6.283185307179586,\"τ\",Interact.OptionDict(DataStructures.OrderedDict(\"τ\"=>6.28319,\"π\"=>3.14159),Dict(3.14159=>\"π\",6.28319=>\"τ\")),Any[],Any[],true,\"horizontal\")"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "map(display, [\n",
    "    widget(1:10),                 # Slider\n",
    "    widget(false),                # Checkbox\n",
    "    widget(\"text\"),               # Textbox\n",
    "    widget(1.1),                  # Number Textbox\n",
    "    widget([:on, :off]),          # Toggle Buttons\n",
    "    widget(Dict(:π => float(π), :τ => 2π))\n",
    "    ]);"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Julia 0.5.0",
   "language": "julia",
   "name": "julia-0.5"
  },
  "language_info": {
   "file_extension": ".jl",
   "mimetype": "application/julia",
   "name": "julia",
   "version": "0.5.0"
  },
  "widgets": {
   "state": {
    "0537856b-dcef-4a80-b055-397ce2d6b278": {
     "views": [
      {
       "cell_index": 41
      }
     ]
    },
    "0747bcef-b77d-463e-8d90-94117b1d2761": {
     "views": [
      {
       "cell_index": 24
      }
     ]
    },
    "08128fa0-e93c-4175-803f-61bd8b0b50b7": {
     "views": [
      {
       "cell_index": 31
      }
     ]
    },
    "18f83694-d14f-42e8-841f-565121a329a3": {
     "views": [
      {
       "cell_index": 45
      }
     ]
    },
    "20ac9ac0-26aa-4eac-bc98-633b2760dbaa": {
     "views": [
      {
       "cell_index": 10
      }
     ]
    },
    "342f4b4d-5a81-4e0b-bad8-0c99e958ccbd": {
     "views": [
      {
       "cell_index": 45
      }
     ]
    },
    "393c18a2-1c49-4489-838c-90d3bc357dc1": {
     "views": [
      {
       "cell_index": 45
      }
     ]
    },
    "3cfb5447-06f6-4fa4-8903-d74e9e3a43be": {
     "views": [
      {
       "cell_index": 10
      }
     ]
    },
    "48d1525e-3094-4f33-b5f0-2c2bc2aaad86": {
     "views": [
      {
       "cell_index": 22
      }
     ]
    },
    "4a42212f-531e-4aab-b5a6-1879735e6685": {
     "views": [
      {
       "cell_index": 5
      }
     ]
    },
    "4bd7e200-c768-4557-884d-c1416ba1e92e": {
     "views": [
      {
       "cell_index": 45
      }
     ]
    },
    "6091fedb-c52f-49f6-a4c8-5a7e3a92399e": {
     "views": [
      {
       "cell_index": 45
      }
     ]
    },
    "72ec5f22-631d-4444-908f-560774003564": {
     "views": [
      {
       "cell_index": 45
      }
     ]
    },
    "896d5dd8-35d1-4f2b-a542-9b7f655ac413": {
     "views": [
      {
       "cell_index": 6
      }
     ]
    },
    "9993b892-1e49-404d-bf90-08d5f39c4acd": {
     "views": [
      {
       "cell_index": 27
      }
     ]
    },
    "9b514a32-2ae8-415b-bbf1-6b48e3a52ae3": {
     "views": [
      {
       "cell_index": 17
      }
     ]
    },
    "9f241f8e-e4ce-46a7-9795-b28efa15515e": {
     "views": [
      {
       "cell_index": 45
      }
     ]
    },
    "a298204c-a73a-4ecf-96a6-c1c592d4c357": {
     "views": [
      {
       "cell_index": 10
      }
     ]
    },
    "a479df4a-4aed-4b02-adc5-2aadcba9f149": {
     "views": [
      {
       "cell_index": 45
      }
     ]
    },
    "ac721d1a-8611-4241-a41c-6b29be098235": {
     "views": [
      {
       "cell_index": 34
      }
     ]
    },
    "adcb4e24-ac2e-4de0-9610-280b8f3141bd": {
     "views": [
      {
       "cell_index": 13
      }
     ]
    },
    "b185098b-737c-407a-97fb-d614965e4bda": {
     "views": [
      {
       "cell_index": 42
      }
     ]
    },
    "bfacaf3f-3d64-44d5-8440-1c232d74359e": {
     "views": [
      {
       "cell_index": 37
      }
     ]
    },
    "db384733-7369-4102-a0a9-83662119a087": {
     "views": [
      {
       "cell_index": 10
      }
     ]
    },
    "ebba2f4d-9536-4acb-aff6-6fc2143a5d74": {
     "views": [
      {
       "cell_index": 45
      }
     ]
    }
   },
   "version": "1.2.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
